home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / WMS.CAB / server_stopped.asp < prev    next >
Encoding:
Text File  |  2003-02-21  |  17.6 KB  |  410 lines

  1. <%@ Language=VBScript CODEPAGE=65001 %>
  2. <!--#include file="wmsConstants.inc"-->
  3. <!--#include file="wmsLocStrings.inc"-->
  4. <!--#include file="wmsCommon.inc"-->
  5. <!--#include file="wmsHeader.inc"--> 
  6. <!--#include file="wmsServerHash.inc"-->
  7. <!--#include file="wmsconnect.inc"-->
  8. <!--#include file="wmsError.inc"--> 
  9. <% 
  10. '+-------------------------------------------------------------------------
  11. '
  12. '  Microsoft Windows Media
  13. '  Copyright (C) Microsoft Corporation. All rights reserved.
  14. '
  15. '  File:       Server_Stopped.asp
  16. '
  17. '  Contents:    Shown when there's a connection failure
  18. '
  19. '--------------------------------------------------------------------------
  20.  
  21. Response.Clear
  22. on error resume next
  23.  
  24. Dim dwConnectionFailureCode
  25. Dim bRedirectedFromConnectionFailure
  26. Dim bRedirectToAdmin
  27. Dim bShowTryAgain
  28. Dim dwTabIndex
  29.  
  30. bShowTryAgain = true
  31. dwConnectionFailureCode = s_WMSAdmin.GetServiceStatus( g_strDecodedServerName )
  32. dwTabIndex = 1
  33.  
  34. ' Connect to WMSASPAdmin.DLL -- the glue that connects to the Windows Media Server
  35. '
  36. '  NOTE:  If this fails, then the Windows Media Server's administration components
  37. '  have not been installed properly.  This may be fixed by typing the following
  38. '  commands from the comand line:
  39. '
  40. '   pushd %sytemroot%\system32\windows media\server\admin\asp\
  41. '   regsvr32 wmsaspadmin.dll
  42. '
  43. '  Should this fail, please re-install Windows Media Server from the Windows XP 
  44. '  distribution CD.
  45. '
  46. Set s_WMSAdmin = Session( "WMSAdmin" )
  47. if( IsEmpty( s_WMSAdmin ) ) then
  48.     Set s_WMSAdmin = Server.CreateObject("WMSAdminRemote.ASPAdmin")
  49.     Set Session("WMSAdmin") = s_WMSAdmin
  50. end if
  51.  
  52. if( IsEmpty( s_WMSAdmin ) ) then
  53.     ' If this happens, check to ensure WMSASPADMIN.DLL is registered properly.
  54.     if g_bDebugMode then
  55.         STOP
  56.     end if
  57. end if
  58.  
  59. bRedirectedFromConnectionFailure = Session( "ConnectionFailure" )
  60. bRedirectToAdmin = FALSE
  61. if( 0 = Len( g_strDecodedServerName ) ) then
  62.     g_strDecodedServerName = ServerHashKeyToName( g_strQueryStringServer )
  63. end if
  64.  
  65. if( ( 0 < Len( qs( "stopping" ) ) ) and ( WMS_SERVER_UNKNOWN = dwConnectionFailureCode ) ) then
  66.     dwConnectionFailureCode = WMS_SERVICE_STOPPED
  67. '    Response.Redirect( "server_stopped.asp?server=" & g_strQueryStringServer )
  68. end if
  69.  
  70. if( ( FALSE = bRedirectedFromConnectionFailure ) and ( WMS_SERVICE_STARTED = dwConnectionFailureCode ) ) then
  71.     ConnectToServer()
  72.     if( empty <> g_objServer ) then
  73.         bRedirectToAdmin = TRUE
  74.     end if
  75. else
  76.     if( ( FALSE = bRedirectedFromConnectionFailure ) and ( 0 = StrComp( g_strQueryStringServerOp, "connect", vbTextCompare ) ) ) then
  77.         ConnectToServer()
  78.         if( empty <> g_objServer ) then
  79.             bRedirectToAdmin = TRUE
  80.         end if
  81.     end if
  82. end if
  83.  
  84. Dim strTitleString
  85.  
  86. Select Case( dwConnectionFailureCode )
  87.     case WMS_SERVICE_STOPPED
  88.         strTitleString = L_SERVERSTOPPED_TEXT
  89.     case WMS_HOST_UNAVAILABLE
  90.         strTitleString = L_CANNOTCONNECTTOWMSERROR1_TEXT
  91.     case WMS_SERVICE_UNAVAILABLE
  92.         strTitleString = WMS_SERVICE_UNAVAILABLE
  93.     case else
  94.         if( IsEmpty( g_objServer ) ) then
  95.             strTitleString = WMS_SERVICE_UNAVAILABLE
  96.         else
  97.             strTitleString = L_CONNECTIONFAILURE_TEXT
  98.         end if
  99. End Select
  100.  
  101. WriteHTMLHeader( RemoveDangerousCharacters( strTitleString ) ) %>
  102. <script language="JavaScript" src="/wmssecure/include/WMSCommon.js"></script>
  103. <link rel="stylesheet" type="text/css" href="/wmssecure/<%= Session( "cssName" ) %>">
  104. <script language="JavaScript">
  105. <!--
  106. /*@cc_on @*/
  107. ////////////////////////////////////////////////////////////////////////////////////////////////////
  108. function RedirectToAdmin()
  109. {
  110.     <% jsTRY %>
  111.         window.parent.parent.document.location.replace( "/wmssecure/admin.asp?server=<%= g_strQueryStringServer %>" );
  112.     <% jsCATCH %>
  113. }
  114.  
  115. ///////////////////////////////////////////////////////
  116. function OnLogOffClicked()
  117. {
  118.     <% jsTry %>
  119.         var winServerList = null;
  120.         var szFeatures = "";
  121.         winServerList = window.open( "", "sList", szFeatures, true );        
  122.         if( winServerList )
  123.         {
  124.             var szwinLoc = new String( winServerList.location );
  125.             if( 0 < szwinLoc.length )
  126.             {
  127.                 winServerList.location.replace( document.location.protocol + "//" + document.location.hostname + ":" + document.location.port + "/WMSLogOff.asp?terminate=1" );
  128.             }
  129.         }
  130.         var winHelp = window.open( "", "HELP", szFeatures, true );
  131.         window.focus();
  132.         if( winHelp )
  133.         {
  134.             winHelp.close();
  135.         }
  136.  
  137.         window.focus();
  138.         window.parent.parent.location.replace( document.location.protocol + "//" + document.location.hostname + ":" + document.location.port + "/WMSLogOff.asp?terminate=1&close=1" );
  139.     <% jsCATCH %>
  140. }
  141.  
  142. ///////////////////////////////////////////////////////
  143. function OpenServerList()
  144. {
  145.     <% jsTRY %>
  146.         var win = null;
  147.         var szFeatures = "location,menubar,resizable,scrollbars,status,toolbar";
  148.         var szWinName = "sList";
  149.         win = window.open( parent.document.location.protocol + "//" + parent.document.location.host + "/wmssecure/index.asp", szWinName, szFeatures, true );
  150.         if( ! win )
  151.         {
  152.             win = window.open( parent.document.location.protocol + "//" + parent.document.location.host + "/wmssecure/index.asp", szWinName, szFeatures, true );
  153.         }
  154.         else
  155.         {
  156.             win.focus();
  157.         }
  158.         win.location.reload();
  159.     <% jsCATCH %>
  160. }
  161.  
  162. ////////////////////////////////////////////////////////////////////////////////////////////////////
  163. function Reconnect( bStartService )
  164. {
  165.     <% jsTRY %>
  166.         var szOp;
  167.  
  168.         if( bStartService )
  169.         {
  170.             szOp = "start";
  171.         }
  172.         else
  173.         {
  174.             szOp = "";
  175.         }
  176.         //
  177.         //  Taking care to remove any previous serverop arg from the query string...
  178.         //
  179.         window.parent.parent.document.location.replace( window.parent.parent.document.location.protocol + "//" + window.parent.parent.document.location.host + "/wmssecure/admin.asp?server=<%= g_strQueryStringServer %>&serverop=" + szOp + "&failCode=<%= dwConnectionFailureCode %>" );
  180.     <% jsCATCH %>
  181. }
  182.  
  183. ////////////////////////////////////////////////////////////////////////////////////////////////////
  184. function UseSingleFrame()
  185. {
  186.     <% jsTRY %>
  187. <%
  188. if( brMSIE <> g_dwBrowserType ) then %>
  189.         if( parent.document.location != document.location )
  190.         {
  191.             parent.document.location.replace( parent.document.location.protocol + "//" + parent.document.location.host + "/wmssecure/include/server_stopped.asp?server=<%= g_strQueryStringServer %>&serverop=" );
  192. <% else %>
  193.         if( window.parent != window )
  194.         {
  195.             document.parentWindow.parent.parent.location.replace( document.parentWindow.parent.parent.location.protocol + "//" + document.parentWindow.parent.parent.location.host + "/wmssecure/include/server_stopped.asp?server=<%= g_strQueryStringServer %>&serverop=" );<%
  196. end if %>
  197.         }
  198.     <% jsCATCH %>
  199.     return;
  200. }
  201.  
  202. ////////////////////////////////////////////////////////////////////////////////////////////////////
  203. function ReloadTopDocument()
  204. {
  205.     <% jsTRY %>
  206. <% if( brMSIE = g_dwBrowserType ) then %>
  207.         window.parent.location = window.parent.location;
  208. <% else %>
  209.         parent.document.location = parent.document.location;
  210. <% end if %>
  211.     <% jsCATCH %>
  212. }
  213.  
  214. ////////////////////////////////////////////////////////////////////////////////////////////////////
  215. function SleepAndTryAgain()
  216. {
  217.     <% jsTRY %>
  218. <% if WMS_SERVICE_INERROR = dwConnectionFailureCode then %>
  219.         setTimeout( "Reconnect( true );", 20000, "JavaScript" );
  220. <% else %>
  221.         setTimeout( "Reconnect( false );", 20000, "JavaScript" );
  222. <% end if %>
  223.     <% jsCATCH %>
  224. }
  225. -->
  226. </script><%
  227.  
  228. Dim dwTimeout
  229. if WMS_SERVICE_STARTING = dwConnectionFailureCode then
  230.     dwTimeout = 3
  231. else
  232.     dwTimeout = 30
  233. end if 
  234. %>
  235. <meta HTTP-EQUIV="refresh" content="<%= dwTimeout %>;url=<%= Request.ServerVariables("url") & "?" & Request.QueryString %>"/>
  236. </head> 
  237. <body bgcolor="white" topmargin="0" leftmargin="0" rightmargin="0" marginwidth="0" onload="JavaScript:<% if bRedirectToAdmin then %>RedirectToAdmin();<% end if %>UseSingleFrame();<% if FALSE = bRedirectedFromConnectionFailure then %>SleepAndTryAgain();<% end if %>"><table width="100%" bgcolor="white" cellspacing="5" border="0">
  238. <table cellspacing="0" cellpadding="0" border="0">
  239. <tr>
  240.     <td>
  241.          
  242.     </td>
  243.     <td width="110" height="101" valign="middle">
  244.         <img src="/wmssecure/img/winmedia.gif" width="121" height="111" border="0">
  245.      </td>
  246.     <td align="left" valign="middle">
  247.         <br>
  248.         <div class="servername">
  249.             <% 
  250.             ConnectToServer
  251.             if( bRedirectToAdmin ) then
  252.                 Response.Write( Server.HTMLEncode( L_SERVICESTARTING_TEXT ) )
  253.             elseif( WMS_SERVICE_STOPPED = dwConnectionFailureCode ) then
  254.                 Response.Write( Server.HTMLEncode( L_SERVERSTOPPED_TEXT ) )
  255.             elseif( WMS_SERVICE_STARTING = dwConnectionFailureCode ) then
  256.                 Response.Write( Server.HTMLEncode( L_SERVICESTARTING_TEXT ) )
  257.             elseif( WMS_HOST_UNAVAILABLE = dwConnectionFailureCode ) then
  258.                 Response.Write( Server.HTMLEncode( L_CANNOTCONNECTTOWMSERROR1_TEXT ) )
  259.             elseif( IsEmpty( g_objServer ) or ( WMS_SERVICE_UNAVAILABLE = dwConnectionFailureCode ) ) then
  260.                 dwConnectionFailureCode = WMS_SERVICE_UNAVAILABLE
  261.                 Response.Write( Server.HTMLEncode( L_SERVICEUNAVAILABLE_TEXT ) )
  262.             end if
  263.             %>
  264.         </div>
  265.     </td>
  266.     <td>
  267.          
  268.     </td>
  269. </tr>
  270. <tr>
  271.     <td>
  272.          
  273.     </td>
  274.     <td colspan="3">
  275.         <p><% 
  276.                 if( 0 < Len( g_strDecodedServerName ) ) then %>
  277.             <div class="stopped"> <%= Server.HTMLEncode( L_ATTEMPTEDTOCONNECTTO_TEXT ) & " " %><font color="yellow"><%= Server.HTMLEncode( SafeUnescape( g_strDecodedServerName ) ) %></font></div>
  278. <% if( WMS_SERVICE_STARTING <> dwConnectionFailureCode ) and _
  279.      ( WMS_SERVICE_STARTED <> dwConnectionFailureCode ) and _
  280.      ( FALSE = bRedirectToAdmin )  then %>
  281.         <p>
  282.             <div class="helptext"><%
  283.                     if WMS_SERVICE_STOPPED = dwConnectionFailureCode then
  284.                         Response.Write( Server.HTMLEncode( L_SERVICESTOPPED_TEXT ) )
  285.                     elseif WMS_HOST_UNAVAILABLE = dwConnectionFailureCode then
  286.                         Response.Write( Server.HTMLEncode( L_MACHINEUNREACHABLE_TEXT ) )
  287.                     elseif WMS_SERVICE_UNAVAILABLE = dwConnectionFailureCode then
  288.                         Response.Write( Server.HTMLEncode( L_SERVICENOTAVAILABLE_TEXT ) )
  289.                         
  290.                         if TRUE = Session( "Initialized" ) then
  291.                             if( ( null = g_objDictionary ) or IsEmpty( g_objDictionary ) ) then
  292.                                 bShowTryAgain = false
  293.                             else
  294.                                 if( null <> g_objDictionary.Exists( g_strQueryStringServer ) ) then
  295.                                     bShowTryAgain = true
  296.                                 end if
  297.                             end if
  298.                         end if
  299.                         
  300.                     elseif WMS_SERVICE_INERROR = dwConnectionFailureCode then
  301.                         Response.Write( Server.HTMLEncode( L_SERVICEERROR_TEXT ) )
  302.                     else
  303.                         Response.Write( Server.HTMLEncode( L_CANNOTCONNECTTOWMS_TEXT ) & "<l>" )
  304.                         Response.Write( "<li>" & Server.HTMLEncode( L_CANNOTCONNECTLI1_TEXT ) & "</li>" )
  305.                         Response.Write( "<li>" & Server.HTMLEncode( L_CANNOTCONNECTLI2_TEXT ) & "</li>" )
  306.                         Response.Write( "<li>" & Server.HTMLEncode( L_CANNOTCONNECTLI3_TEXT ) & "</li></l>" )
  307.                     end if %>
  308.             </div><% 
  309.                 elseif( FALSE = Session( "Initialized" ) ) then %>
  310.             <div class="stopped"> <%= Server.HTMLEncode( L_SESSIONEXPIRED_TEXT ) & " " %></div>
  311.             <script language="JavaScript">
  312.             <!--
  313.             function HandleSessionExpiration()
  314.             {
  315.                 window.parent.parent.location = document.location.protocol + "//" + document.location.hostname + ":" + document.location.port + "/WMSLogOff.asp";
  316.                 return;
  317.                 
  318.                 <% 
  319.                 if IsEmpty( Session( "bAlertedToSessionEnd" ) ) then 
  320.                     Session( "bAlertedToSessionEnd" ) = TRUE
  321.                 %>
  322.                 window.alert( "<%= RemoveDangerousCharacters( L_SESSIONEXPIRED_TEXT ) %>" );
  323.                 <% 
  324.                 end if
  325.  
  326.                 if( brMSIE = g_dwBrowserType ) then
  327.                 %>
  328.                     window.parent.parent.document.location = window.parent.parent.document.location.protocol + "//" + window.parent.parent.document.location.host;
  329.                 <% else %>
  330.                     parent.document.location = parent.document.location.protocol + "//" + parent.document.location.host;
  331.                 <% end if %>
  332.             }
  333.             HandleSessionExpiration();
  334.             -->
  335.             </script>
  336.             <% 
  337.             end if 
  338.         end if 
  339.     %>
  340.     </td>
  341. </tr>
  342. <tr>
  343.     <td>
  344.          
  345.     </td>
  346.     <td colspan="2">
  347.         <br>
  348.         <img src="/wmssecure/img/WMSSpacer.gif" width="2" height="14"> 
  349.     </td>
  350. </tr>
  351. <tr>
  352.     <td>
  353.          
  354.     </td>
  355.     <td align="left" colspan="2">
  356.         <form id="form1" name="form1"><% 
  357.         
  358. if TRUE = Session( "Initialized" ) then
  359.     if ( 0 = strcomp( "kill", g_strQueryStringServerOp, vbTextCompare ) ) then %>
  360.         <input type="button" align="baseline" name="<%= Server.HTMLEncode( L_RESTARTSERVICEBUTTON_TEXT ) %>" tabIndex=<%= dwTabIndex %> <% dwTabIndex = dwTabIndex + 1 %> value="<%= Server.HTMLEncode( L_RESTARTSERVICEBUTTON_TEXT ) %>" onclick="Javascript:Reconnect( true );this.disabled=true;"> <% 
  361.     elseif WMS_SERVICE_STOPPED = dwConnectionFailureCode then %>
  362.         <input type="button" align="baseline" name="<%= Server.HTMLEncode( L_STARTSERVICEBUTTON_TEXT ) %>" tabIndex=<%= dwTabIndex %> <% dwTabIndex = dwTabIndex + 1 %> value="<%= Server.HTMLEncode( L_STARTSERVICEBUTTON_TEXT ) %>" onclick="Javascript:Reconnect( true );this.disabled=true;"> <%
  363.     elseif ( WMS_SERVICE_STARTED = dwConnectionFailureCode ) or _
  364.            ( WMS_SERVICE_STARTING = dwConnectionFailureCode ) then %>
  365.         <input type="button" align="baseline" name="<%= Server.HTMLEncode( L_STARTSERVICEBUTTON_TEXT ) %>" tabIndex=<%= dwTabIndex %> <% dwTabIndex = dwTabIndex + 1 %> value="<%= Server.HTMLEncode( L_STARTSERVICEBUTTON_TEXT ) %>" onclick="Javascript:Reconnect( true );this.disabled=true;" disabled> <%
  366.     elseif WMS_SERVICE_INERROR = dwConnectionFailureCode then %>
  367.         <input type="button" align="baseline" name="<%= Server.HTMLEncode( L_TRYAGAINBUTTON_TEXT ) %>" tabIndex=<%= dwTabIndex %> <% dwTabIndex = dwTabIndex + 1 %> value="<%= Server.HTMLEncode( L_TRYAGAINBUTTON_TEXT ) %>" onclick="Javascript:Reconnect( true );this.disabled=true;"> <%
  368.     elseif WMS_SERVICE_FAILEDTOSTART = dwConnectionFailureCode then %>
  369.         <input type="button" align="baseline" name="<%= Server.HTMLEncode( L_STARTSERVICEBUTTON_TEXT ) %>" tabIndex=<%= dwTabIndex %> <% dwTabIndex = dwTabIndex + 1 %> value="<%= Server.HTMLEncode( L_STARTSERVICEBUTTON_TEXT ) %>" onclick="Javascript:Reconnect( true );this.disabled=true;"> <%
  370.     elseif ( TRUE = bShowTryAgain ) then 
  371.     %>
  372.         <input type="button" align="baseline" name="<%= Server.HTMLEncode( L_TRYAGAINBUTTON_TEXT ) %>" tabIndex=<%= dwTabIndex %> <% dwTabIndex = dwTabIndex + 1 %> value="<%= Server.HTMLEncode( L_TRYAGAINBUTTON_TEXT ) %>" onclick="Javascript:Reconnect( false );this.disabled=true;"> <%
  373.     end if 
  374.  
  375.     if ( TRUE = Session( "ShowServerList" ) ) then %>
  376.     <input type="button" align="baseline" name="<%= Server.HTMLEncode( L_RETURNTOSLISTBUTTON_TEXT ) %>" tabIndex=<%= dwTabIndex %> <% dwTabIndex = dwTabIndex + 1 %> value="<%= Server.HTMLEncode( L_RETURNTOSLISTBUTTON_TEXT ) %>" onclick="JavaScript:OpenServerList();" ID="Button2"> <%
  377.     else %>
  378.     <input type="button" align="baseline" name="<%= Server.HTMLEncode( L_CLOSEBUTTONSPACED_TEXT ) %>" tabIndex=<%= dwTabIndex %> <% dwTabIndex = dwTabIndex + 1 %> value="<%= Server.HTMLEncode( L_CLOSEBUTTONSPACED_TEXT ) %>" onclick="Javascript:if( window.parent ) { window.parent.close(); } else window.close();this.disabled=true;" ID="Button1"> <%
  379.     end if %>
  380.     <input type="button" align="baseline" name="<%= Server.HTMLEncode( L_LOGOFFBTN_TEXT ) %>" tabIndex=<%= dwTabIndex %> <% dwTabIndex = dwTabIndex + 1 %> value="<%= Server.HTMLEncode( L_LOGOFFBTN_TEXT ) %>" onclick="Javascript:OnLogOffClicked();this.disabled=true;"> <%
  381.  
  382. end if
  383.     %>
  384.          </form>
  385.     </td>
  386. </tr>
  387. </table>
  388. </body>
  389. <% if ( FALSE = bRedirectedFromConnectionFailure ) and ( 0 = Len( qs("failCode") ) ) then
  390.     if( WMS_SERVICE_STARTED = dwConnectionFailureCode ) and ( 0 < Len( g_strQueryStringServerOp ) ) and ( not IsEmpty( g_objServer ) ) then %>
  391. <script language="Javascript">
  392. <!--
  393.         <% if ( 0 = Len( g_strQueryStringServerOp ) ) then %>
  394.     window.alert( "<%= RemoveDangerousCharacters( L_CONNECTIONFAILURE_TEXT ) %>" );
  395.         <% else %>
  396.     UseSingleFrame();
  397.         <% end if %>
  398. -->
  399. </script>
  400.     <% end if %>
  401. <% end if %>
  402. </html>
  403. <%
  404. Session( "ConnectionFailure" ) = FALSE
  405. Session( "TransferFromAdmin" ) = FALSE
  406.  
  407. on error resume next
  408. WMSServerHashASPCleanup
  409. WMSConnectASPCleanup
  410. %>